<?php

/**
 * This is the model class for table "{{trans}}".
 *
 * The followings are the available columns in table '{{trans}}':
 * @property string $id
 * @property string $loginname
 * @property integer $accountid
 * @property integer $amount
 * @property string $deposittime
 * @property string $jointime
 * @property integer $flag
 * @property string $describe
 * @property string $remark
 */
class Trans extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Trans the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return '{{trans}}';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('loginname, accountid, deposittime, jointime', 'required'),
			array('accountid, amount, flag', 'numerical', 'integerOnly'=>true),
			array('loginname', 'length', 'max'=>16),
			array('describe', 'length', 'max'=>64),
			array('remark', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, loginname, accountid, amount, deposittime, jointime, flag, describe, remark', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'loginname' => 'Loginname',
			'accountid' => 'Accountid',
			'amount' => 'Amount',
			'deposittime' => 'Deposittime',
			'jointime' => 'Jointime',
			'flag' => 'Flag',
			'describe' => 'Describe',
			'remark' => 'Remark',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id,true);
		$criteria->compare('loginname',$this->loginname,true);
		$criteria->compare('accountid',$this->accountid);
		$criteria->compare('amount',$this->amount);
		$criteria->compare('deposittime',$this->deposittime,true);
		$criteria->compare('jointime',$this->jointime,true);
		$criteria->compare('flag',$this->flag);
		$criteria->compare('describe',$this->describe,true);
		$criteria->compare('remark',$this->remark,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}